import request from '@/utils/request'

export function searchAll(pageNo, pageSize) {
  return request({
    url: '/perf/script/find/all',
    method: 'get',
    params: { pageNo, pageSize }
  })
}

export function detail(id) {
  return request({
    url: '/perf/script/detail',
    method: 'get',
    params: { id }
  })
}

export function myUpload(uploadId, data) {
  return request({
    url: '/perf/script/upload?uploadId=' + uploadId,
    method: 'post',
    timeout: 3600000,
    data
  })
}

export function uploadProcess(uploadId) {
  return request({
    url: '/perf/script/upload/process',
    method: 'get',
    params: { uploadId }
  })
}

export function clearProcess(uploadId) {
  return request({
    url: '/perf/script/clear/process',
    method: 'get',
    params: { uploadId }
  })
}

export function deleteScript(id) {
  return request({
    url: '/perf/script/delete',
    method: 'get',
    params: { id }
  })
}

export function updateResource(scriptId, resourceIds) {
  return request({
    url: '/perf/script/updateResource',
    method: 'get',
    params: { scriptId, resourceIds }
  })
}

export function updateContent(data) {
  return request({
    url: '/perf/script/updateContent',
    method: 'post',
    timeout: 3600000,
    data
  })
}
